//获取应用实例
var app = getApp();
Page({
  data: {
    loading:false,
    // maskHidden: true,
    // imagePath: '',
    // placeholder: 'http://zazhi.gzgaodu.com/data_focus/zazhi/18/101.png?t=1505721038'//默认二维码生成文本
  },
  onLoad: function (options) {
    var that = this;
    wx.getSystemInfo({
      success: function (res) {
        that.setData({
          height:res.windowHeight
        })
      }
    })
    that.setData({
      shareInfo: {
        title: options.name+ "邀请您加入非常儿科",
        path: '/pages/sharecode/sharecode?id=' + options.user_id
      }
    })
    if(options.id!=undefined){
      app.getLoginSession(function (session) {
        wx.request({
          url: app.api,
          data: {
            app: 'article',
            act: 'invite_user',
            id: options.id,
            t_session:session
          },
          success: function (res) {
            var data = res.data;
            console.log(JSON.stringify(res)+"aaaaaaa");
            if(data.done&&data.retval.msg=="被邀请成功！"){
              wx.showToast({
                title: '加入成功',
                icon:'success'
              })
            }else{
              wx.showToast({
                title: '加入失败',
                icon:'loading'
              })
            }
          }
        })
      })
      
    }
  }, 
  onShareAppMessage() {
    return this.data.shareInfo
  },
})